﻿@model SDSystem.Models.News
@{
    ViewBag.Title = "Create News";
    Layout = "~/Views/Shared/_LayoutHtml.cshtml";
}
@using(Html.BeginForm())
{
    @Html.ValidationSummary(true)
    <fieldset>
        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </div>
        
        <div class="editor-label">
            @Html.LabelFor(model => model.Tag)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Tag)
            @Html.ValidationMessageFor(model => model.Tag)
        </div>
        
        <div class="editor-label">
            @Html.LabelFor(model => model.Title)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Title)
            @Html.ValidationMessageFor(model => model.Title)
        </div>
        
        <div class="editor-label">
            @Html.LabelFor(model => model.Image)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Image,new {@id="NewsImage"})
            @Html.ValidationMessageFor(model => model.Image)
            <input type="button" value="Browser..." id="btnImage"/>
            <script type="text/javascript">
                $(document).ready(function () {
                    $("#btnImage").click(function () {
                        var ckImage = new CKFinder();
                        ckImage.selectActionFunction = function (fileUrl) {
                            $("#NewsImage").val(fileUrl);
                        };
                        ckImage.popup();
                    });
                });
            </script>
        </div>
        
        <div class="editor-label">
            @Html.LabelFor(model => model.Description)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(m => m.Description, new { @id = "descriptionCk" })
            <script type="text/javascript">
                var editorContent = CKEDITOR.replace("descriptionCk"
                //                    ,{
                //                        toolbar : 'Basic'
                //                    }
                );
                CKFinder.setupCKEditor(editorContent, '/ckfinder/');
            </script>
        </div>
        
        <div class="editor-label">
            @Html.LabelFor(model => model.Content)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(m => m.Content, new { @id = "contentCk" })
            <script type="text/javascript">
                var editorContent = CKEDITOR.replace("contentCk");
                CKFinder.setupCKEditor(editorContent, '/ckfinder/');
            </script>
        </div>
        
        <div class="editor-label">
            @Html.LabelFor(model => model.Keyword)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Keyword)
            @Html.ValidationMessageFor(model => model.Keyword)
        </div>
        
        <div class="editor-label">
            @Html.LabelFor(model => model.GroupNew)
        </div>
        <div class="editor-field">
            @Html.DropDownList("ListGroupNews", (IEnumerable<SelectListItem>)ViewBag.ListGroupNews,"----------Select GroupNews----------")
        </div>
        <br/>
        <p>
            <input type="submit" name="btnCreate" value="Create"/>
            <input type="submit" name="btnPreview" value="Preview"/>
        </p>
    </fieldset>
}
